package top.jidanmin.demo.lightserver;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import lombok.extern.slf4j.Slf4j;
import top.jidanmin.demo.lightserver.device.Device;
import top.jidanmin.demo.lightserver.device.DeviceService;

@SpringBootApplication
@Slf4j
public class LightServerApplication {

	public static void main(String[] args) {
		SpringApplication.run(LightServerApplication.class, args);
	}

	@Bean
	CommandLineRunner runner(DeviceService service) {
		return args -> {
			log.info("向数据库添加数据");

			Device device = new Device();
			device.setName("红外遥控器 - 格力");

			service.addDevice(device);
		};
	}
}
